Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MBL-1816] PLOT Ineligible state #2220

Merged
merged 23 commits into from
Dec 18, 2024
Merged

Conversation

jovaniks
Copy link
Contributor

📲 What

This PR implements the "PLOT ineligible" state for the Payment Plan Selector. It disables the "Pledge Over Time" option when the total pledge amount is below the threshold of $150.00 and displays a note indicating the ineligibility, with the amount converted using the project’s currency.

🤔 Why

The "PLOT is NOT eligible" state ensures backers understand why the "Pledge Over Time" option is unavailable. This limitation is based on the total pledge amount being below the required threshold of $150.00. By providing clear feedback, users are informed of the eligibility requirements.

🛠 How

Adding the new field ineligible to PledgePaymentPlanOptionData and PledgePaymentPlansAndSelectionData

👀 See

Eligible Ineligible
Simulator Screen Recording - iPhone SE (3rd generation) - 2024-12-11 at 11 14 35 Simulator Screen Recording - iPhone SE (3rd generation) - 2024-12-11 at 11 13 33

✅ Acceptance criteria

  • Tests should pass
  • Ineligible UI should show when total < 150
  • Eligible UI should show when total >= 150

⏰ TODO

  • Connect the API to have the ineligible flag from BE

@jovaniks jovaniks self-assigned this Dec 11, 2024
@jovaniks jovaniks changed the base branch from main to jluna/MBL-1815/plot-plan-selector-selected-state December 11, 2024 20:58
Copy link
Contributor

@scottkicks scottkicks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Had just a few suggestions that should be pretty easy to get in before we merge this

@@ -174,6 +205,7 @@ final class PledgePaymentPlanOptionView: UIView {
self.titleLabel.rac.text = self.viewModel.outputs.titleText

self.subtitleLabel.rac.text = self.viewModel.outputs.subtitleText
self.subtitleLabel.isHidden = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably go in applySubtitleLabelStyle with the other styles.

Library/Extensions/UIView+Helper.swift Show resolved Hide resolved
…jluna/MBL-1816/plot-ineligible-state

# Conflicts:
#	Library/ViewModels/NoShippingPledgeViewModel.swift
Copy link
Contributor

@amy-at-kickstarter amy-at-kickstarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like the minimum was already been changed to $125! Let's see if we can get that in the API and make it dynamic. I brought up this issue in #ppo-mobile-squad.

In the meantime, can you add the threshold amount of $125 to your view model object, instead of hardcoding it in several places and in the string? Let's treat it like it is coming from the API, and then it will be an easy fix when the API is updated.

@@ -76,6 +84,8 @@ final class PledgePaymentPlanOptionView: UIView {
),
for: .normal
)

self.ineligibleBadgeLabel.text = "Available for pledges over $150"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two thoughts:

  1. The $150 minimum - or even better, the whole badge text! - should come from the API. It seems likely to change.
  2. This needs a //todo comment for translations

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raising this in #ppo-mobile-squad

@@ -130,6 +140,30 @@ final class PledgePaymentPlanOptionView: UIView {
])

self.termsOfUseButton.setContentHuggingPriority(.required, for: .horizontal)

self.ineligibleBadgeView.addSubview(self.ineligibleBadgeLabel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be slightly cleaner/more brief if the ineligibleBadgeView was its own UIView subclass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the follow up/clean up ticket https://kickstarter.atlassian.net/browse/MBL-1940

project: project,
rewards: [reward],
selectedShippingRule: .template,
selectedQuantities: [reward.id: 150], // To pass the threshold validation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this threshold only need to be 15 since each reward is $10. The screenshot below is for a reward of $1,500 which is a little confusing.

Library/ViewModels/NoShippingPledgeViewModel.swift Outdated Show resolved Hide resolved
Base automatically changed from jluna/MBL-1815/plot-plan-selector-selected-state to main December 17, 2024 20:08
# Conflicts:
#	Kickstarter-iOS/Features/PledgeOverTime/Controller/PledgePaymentPlansViewController.swift
#	Kickstarter-iOS/Features/PledgeOverTime/Controller/PledgePaymentPlansViewControllerTest.swift
#	Kickstarter-iOS/Features/PledgeOverTime/Views/PledgePaymentPlanOptionView.swift
#	Library/ViewModels/NoShippingPledgeViewModel.swift
#	Library/ViewModels/PledgePaymentPlansOptionViewModel.swift
#	Library/ViewModels/PledgePaymentPlansOptionViewModelTest.swift
#	Library/ViewModels/PledgePaymentPlansViewModel.swift
#	Library/ViewModels/PledgePaymentPlansViewModelTest.swift
Copy link
Contributor

@amy-at-kickstarter amy-at-kickstarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good!

@jovaniks jovaniks merged commit bbbc526 into main Dec 18, 2024
5 checks passed
@jovaniks jovaniks deleted the jluna/MBL-1816/plot-ineligible-state branch December 18, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants